﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
    ZFine.Domain.Entity.CourseEntity thisobj = ViewData["objs"] as ZFine.Domain.Entity.CourseEntity;
    if (thisobj == null)
    {
        thisobj = new ZFine.Domain.Entity.CourseEntity();
    }
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {    
        var $distpicker = $('#distpicker');
        if (!!keyValue) {
            $.ajax({
                url: "/Project/Course/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $distpicker.distpicker({
                        province: data.Province,
                        city: data.City,
                        district: data.Region
                    });
                    $("#form1").formSerialize(data);
                    $("#form1").find('.form-control,select').attr('disabled', 'disabled');

                }
            });
        } else {
            $("#form1").formSerialize("add");
            $distpicker.distpicker({
                province: '内蒙古省',
                city: '呼和浩特市',
                district: '玉泉区'
            });
        }
    });
    function submitForm() {
        var postData = $("#form1").formSerialize();
        if (!$('#form1').formValid()) {
            return false;
        }
        debugger;
        $.submitForm({
            url: "/Project/Course/SubmitForm?keyValue=" + keyValue,
            param: postData,
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>
<form id="form1">
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#">基本信息</a></li>
        </ul>
        <div style="padding-top: 20px; margin-right: 30px;">
            <table class="form">
                <tr>
                    <th class="formTitle">课程名称</th>
                    <td class="formValue">
                        @thisobj.Name
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">课程类型</th>
                    <td class="formValue">
                        @thisobj.CourseType
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">课程原价</th>
                    <td class="formValue">
                        @thisobj.CourseOldPrice
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">课程现价</th>
                    <td class="formValue">
                        @thisobj.CourseNowPrice
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">场主姓名</th>
                    <td class="formValue">
                        @thisobj.PublicName
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">课程开始时间</th>
                    <td class="formValue">
                        @thisobj.CourseStartTime
                    </td>
                    <th class="formTitle">课程结束时间</th>
                    <td class="formValue">
                        @thisobj.CourseEndTime
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">上课时间</th>
                    <td class="formValue">
                        @thisobj.CourseTime
                    </td>
                    <th class="formTitle">联系电话</th>
                    <td class="formValue">
                        @thisobj.PhoneNumber
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">所属地区</th>
                    <td class="formValue">
                        <div id="distpicker" class="distpicker" style="width:1044px">
                            <select id="Province" name="province" class="form-control required" style="width: 250px; float: left; display: block;"></select>
                            <select id="City" name="city" class="form-control required" style="width: 250px; float: left;display: block; margin-left: 142px;"></select>
                            <select id="Area" name="Area" class="form-control required" style="width: 250px; float: left; display: block; margin-left: 142px;"></select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">详细地址</th>
                    <td class="formValue">
                        @thisobj.Address
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">上传图片</th>
                    <td class="formValue">
                        @thisobj.Image
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">上传视频</th>
                    <td class="formValue">
                        @thisobj.Video
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">课程介绍</th>
                    <td class="formValue">
                        @thisobj.Description
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">注意事项</th>
                    <td class="formValue">
                        @thisobj.CourseAlert
                    </td>
                </tr>
                @{
                    if (thisobj.CourseState == 1)
                    {
                        <tr>
                            <th class="formTitle">驳回理由</th>
                            <td class="formValue">
                                @thisobj.RejectReason
                            </td>
                        </tr>
                    }
                }
            </table>
        </div>
    </div>
</form>
